const BASE_URL = 'https://a.squmo.com/strawberry/'
/**
 * 调用接口
 * ('接口地址'，'需要传的数据')
 */
export const myRequest = (temp_url,temp_data={})=>{
	
	return new Promise((resolve,reject)=>{
		
		uni.request({
			//#ifdef H5
			url:"/ksy/"+temp_url,
			//#endif
			
			//#ifdef APP-PLUS
			url:BASE_URL+temp_url,
			// #endif
			
			// #ifdef MP
			url:BASE_URL+temp_url,
			// #endif 
			data:temp_data,
			method:"POST",
			dataType:"json",
			//必须设置header为这个 数据格式才是formData
		    header:{
			   'content-type':'application/x-www-form-urlencoded',
			},
			success: ({data}) => {
				resolve(data)
			},
			fail: (res) => {
				uni.showToast({
				    title: '网络异常',
					icon:'none',
				});
			}
		})
	})		
}
/**
 * 无分页但是需要在调用的data那儿声明outData:'';
 */
export const initNoPage = (that,api='',data={},outData="") => {
	that.$myRequest(api,data)
	.then(({data,errno,errdesc})=>{
		if(errno == 0) {
			that[outData] = data
			that.temp.ss = "sdsdfd"
		}else {
			that.$Toast.showMsg(errdesc)
		}
	})
}
export const initInPage = (that,api='',inData={page:1},outData='')=>{
	that.$myRequest(api,inData)
	.then(({data:{data_list}})=>{
		
	})
}